/* USER CODE BEGIN Header */
/**
 ******************************************************************************
 * @file    usart.h
 * @brief   This file contains all the function prototypes for
 *          the usart.c file
 ******************************************************************************
 * @attention
 *
 * Copyright (c) 2025 STMicroelectronics.
 * All rights reserved.
 *
 * This software is licensed under terms that can be found in the LICENSE file
 * in the root directory of this software component.
 * If no LICENSE file comes with this software, it is provided AS-IS.
 *
 ******************************************************************************
 */
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __USART_H__
#define __USART_H__

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "global.h"
#include "main.h"

/* USER CODE BEGIN Includes */

/* USER CODE END Includes */

extern UART_HandleTypeDef huart3;

/* USER CODE BEGIN Private defines */

/* USER CODE END Private defines */
/**
 * @brief 串口通信相关
 *
 */
#define ser3_RD_BUFFMAX 256
#define ser3_TX_BUFFMAX 256
extern unsigned char ser3_WrFlag1;
extern unsigned char ser3_WrFlag2;
extern unsigned char ser3_RdFlag; /* 串口接收标志位 1:接受完成*/
extern unsigned char ser3_RdTime;
extern unsigned char ser3_RdStep;
extern unsigned int ser3_RdNum; /* 串口接收数据长度 */
extern unsigned int ser3_TxNum; /* 串口发送数据长度 */
extern char ser3_RB[ser3_RD_BUFFMAX];
extern char ser3_TB[ser3_TX_BUFFMAX];
/**
 * @brief 串口3初始化
 *
 */
void MX_USART3_UART_Init(void);
/**
 * @brief 串口3发送数据
 *
 * @param ser3buff
 * @param TX_Num
 */
void ser3_Write(char *ser3buff, u16 TX_Num);
void ser3_send_log(const char *format, ...);
void ser3_Init(void);
/* USER CODE BEGIN Prototypes */

/* USER CODE END Prototypes */

#ifdef __cplusplus
}
#endif

#endif /* __USART_H__ */
